# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=tlstunnel
pkgver=0.3.0
pkgrel=2
pkgdesc="TLS reverse proxy"
url="https://sr.ht/~emersion/tlstunnel/"
license="MIT"
arch="all"
depends="ca-certificates"
makedepends="go scdoc"
subpackages="$pkgname-doc $pkgname-openrc"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/tlstunnel/archive/v$pkgver.tar.gz
	$pkgname.initd
	config
	"
builddir="$srcdir/tlstunnel-v$pkgver"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	make GOFLAGS="$GOFLAGS"
}

check() {
	go test ./...
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr BINDIR=/usr/sbin install

	install -Dm644 "$srcdir"/config "$pkgdir"/etc/tlstunnel/config

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
99b933741cd8b177055f8c481311ef5bf0255e6179deab7a453a7f9e9910bd0463fcdeead8f578b3e75ef4ed749423b521683defdb0d5cc31f4eeeb4e77d6216  tlstunnel-0.3.0.tar.gz
a03db8adbebf7718e99b0a8431a30d7873b85c5280375e59b9895e95152cb1ad43789fae8e000779195c5502fe03111c44369c31a01190317b61d7a7e3979374  tlstunnel.initd
a4ec6c1ff057b9ad5d9e9294725dbc03f937669da30956c33c11da86f8122740eb9d4989e7dd0ad3032e7351e8bf1f8fa4d2320771aa24d227ff766d20c05258  config
"
